package servlet;

import java.io.IOException;
import java.io.PrintWriter;


import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.db.conn;

public class bookshelf_Edit extends HttpServlet {


	public bookshelf_Edit() {
		super();
	}


	public void destroy() {
		super.destroy(); 
	}

	//编辑书架信息
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		response.setContentType("text/html;");
		PrintWriter out = response.getWriter();

        //声明数据库操作类
		conn cn = new conn();

		//接收传递过来的值
        String id=request.getParameter("id");
        String mid=request.getParameter("txt_mid");
        String bid=request.getParameter("txt_bid");
		
		
        String sql="update bookshelf set mid = "+mid+",bid = "+bid+" where id="+id+"";

        out.println(sql);
		
	
		//执行sql
		cn.update(sql);		

		out.println("<script>");
		out.println("alert('操作成功');");
		out.println("window.location='admin/bookshelf/bookshelf_Manage.jsp'");
		out.println("</script>");
	
		out.flush();
		out.close();
	}


	public void init() throws ServletException {
		// Put your code here
	}

}

